<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
 <script>
    var note;
    function myfocus(fname,notename){
        note = document.getElementById(notename);
        note.innerText=fname+'获得焦点,开始输入';
    }
    
    function myblur(fname,notname){
        note = document.getElementById(notname);
        note.innerText=fname+'失去焦点,开始判断';
    }
  </script>
 </head>
 <body>
 <form name='myform'>
    <input type='text' name='uname' onfocus="myfocus('uname','unote')" onblur="myblur('uname','unote')"/><font id='unote'></font>
    <br/>
    <input type='text' name='pwd' onfocus="myfocus('pwd','pnote')" onblur= "myblur('pwd','pnote')"/><font id='pnote'></font>
 </form>
 </body>

</html>
